/*
* File: GCD
* Author: Dongcheng Li
* Date: 20190909
* Purpose: to solve a problem by GCD:
* https://w.ketangpai.com/pages/homework/homework-detail.html
*/
#include<iostream>
using namespace std;
/*
* Input: an integer a,an integer b
* Output: return the result of gcd.
* Purpose: another way to the result of gcd.
* Method: According to the known knowledge of Euclid.
*/
int GCD(int integer_a, int integer_b)//return the result of GCD.
{
	int container;


while (integer_b != 0)
		{
			container = integer_a;
			integer_a = integer_b;
			integer_b = container % integer_b;
		}
		return integer_a;
	
}
int main() {
	int integer_A;
	int integer_B;
	/*
	integer_A=a
	integer_B=b
	*/

	do {
		cout << "a:" << endl;
		cin >> integer_A;
		cout << "b:" << endl;
		cin >> integer_B;
	} while (integer_A == 0 || integer_B == 0);//Ensure that both integers are not zero.
	
	cout << "GCD(a,b)=" << GCD(integer_A, integer_B) << endl;
}
